package com.taotao.delayjob.example.conf;

import com.github.pagehelper.PageInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;


@Configuration
@MapperScan("com.taotao.delayjob.example.mapper*")
public class MybatisConfig {

    @Value("${pagehelper.dialect:mysql}")
    private String helperDialect;


    @ConditionalOnMissingBean(PageInterceptor.class)
    @Bean
    public PageInterceptor pageInterceptor() {
        PageInterceptor pageInterceptor0 = new PageInterceptor();
        Properties properties = new Properties();
        properties.put("helperDialect", helperDialect);
        //参数方法调用
        properties.put("supportMethodsArguments", "true");

        pageInterceptor0.setProperties(properties);
        return pageInterceptor0;
    }


}